package com.hunttown.mes.common.utils;

/**
 * 密码生成工具
 * created by wangjunfu on 2019-07-06
 */
public class LogonUtils {

    //加密KEY
    public static final String ENCRYPTION_LOGON_KEY = "HCQDWWKPOUG0U7DBMOXK48E37Q6BWJGSYBPOSION4RRPDAR0BM6RLYYTFIP92FJS3NENPGVDBSMJ4ABT9CG==";

    /**
     * 生成32位MD5密码
     *
     * @param logonName 登录名
     * @param pwd       明文密码
     * @return SHA1
     */
    public static String getKeyGen(String logonName, String pwd) {
        String keyCode = String.format("%s%s%s", ENCRYPTION_LOGON_KEY, logonName, pwd);

        String keyGen = SHA1Utils.shaEncode(keyCode);
        keyGen = GetMD5Hash.md5Encode(keyGen, 32, false);

        return keyGen;
    }
}
